package com.dachuang.canjiren.controller;


import com.dachuang.canjiren.service.BusinessService;
import com.dachuang.canjiren.service.WorkService;
import com.dachuang.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-07-27
 */
@RestController
@RequestMapping("/canjiren/business")
public class BusinessController {

    @Autowired
    private BusinessService businessService;

    @GetMapping("insertBusiness")
    R insertBusiness(
                 @RequestParam(value = "logo",required = false) String logo,
                 @RequestParam(value = "name",required = false) String name,
                 @RequestParam(value = "address",required = false)String address,
                 @RequestParam(value = "firld",required = false)String firld,
                 @RequestParam(value = "content",required = false)String content,
                 @RequestParam(value = "prospectus",required = false)String prospectus,
                 @RequestParam(value = "userId",required = false)Integer userId){
        return businessService.insertBusiness(logo, name, address, firld, content, prospectus, userId);
    }

    @GetMapping("selectBusiness")
    R selectBusiness(Integer id){
        return businessService.selectBusiness(id);
    }

    @GetMapping("selectUserBusiness")
    R selectUserBusiness(Integer userId){
        return businessService.selectUserBusiness(userId);
    }

    @GetMapping("selectBusinessList")
    R selectBusinessList(){
        return businessService.selectBusinessList();
    }
}

